package com.bondar.RestLogin.repositories;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.bondar.RestLogin.entities.Role;
import com.bondar.RestLogin.entities.User;

public interface Rolerepository extends JpaRepository<Role, Long> {
	
	@Query("SELECT r FROM Role r WHERE :user MEMBER OF r.users")
	List<Role> findAllRolesByUser(@Param(value = "user") User user);
}
